package KK.View.Window
{
	import KK.Time.Time;
	import KK.WindowSkin.Window;
	
	import flash.display.DisplayObjectContainer;
	import flash.display.Sprite;
	import flash.events.MouseEvent;
	import flash.text.TextField;

	public class MessageBox extends Window
	{
		private var text:TextField;
		public function MessageBox()
		{
			super();
			init();
		}
		
		private function init():void{
			text=new TextField();
			addContent(text);
			GetMC().addEventListener(MouseEvent.MOUSE_DOWN,MouseDown);
			GetMC().addEventListener(MouseEvent.MOUSE_UP,MouseUp);
		}
		
		
		
		/**
		 * 显示文本  
		 * @param value
		 * 
		 */
		public function ShowText(value:String):void{
			text.htmlText=value;
			setSize(text.width+32,text.height+32);
			Show();
		}
		
		/**
		 * 显示窗体  
		 * 
		 */
		override public function Show():void{
			super.Show();
			Time.setTimeout(Hide,3000);
		}
		
		
		
		
		
		
		/**
		 * 开始标题拖动 
		 * 
		 */
		protected function startTitleDrag():void{ 
			
			if(mc.mouseY<16){
				Sprite(mc).startDrag();
			}
			
		}
		
		/**
		 * 停止拖动 
		 * 
		 */
		protected function stopTitleDrag():void{
			Sprite(GetMC()).stopDrag();
		}
		
		
		
		
		/**
		 * 鼠标按下  
		 * @param event
		 * 
		 */
		private function MouseDown(event:MouseEvent):void{
			startTitleDrag();
		}
		
		/**
		 * 鼠标弹起  
		 * @param event
		 * 
		 */
		private function MouseUp(event:MouseEvent):void{
			stopTitleDrag();
		}
		 
		
	}
}